package com.share.dao.oa.org.impl;

import java.util.LinkedHashMap;
import java.util.List;

import org.springframework.stereotype.Component;

import com.share.bean.oa.org.Organization;
import com.share.commons.base.dao.BaseDaoSupport;
import com.share.commons.base.query.PageModel;
import com.share.dao.oa.org.OrganizationDao;

@Component
public class OrganizationDaoImpl extends BaseDaoSupport<Organization> implements OrganizationDao {

	@Override
	public void deleteOrgDao(Object[] ids) throws RuntimeException {
		this.deleteAllObject(Organization.class, ids) ;
	}

	@Override
	public Organization loadById(String id) throws RuntimeException {
		
		return this.loadById(Organization.class, id) ;
	}

	@Override
	public PageModel<Organization> loadScrollOrgDao(String hql, int firstResult,
			int maxResult, LinkedHashMap<String, String> orderby)
			throws RuntimeException {
		
		return this.getScrollData(hql, firstResult, maxResult, orderby) ;
	}

	@Override
	public void saveOrgDao(Organization org) throws RuntimeException {
		this.saveObject(org) ;
	}

	@Override
	public void updateOrgDao(Organization org) throws RuntimeException {
		this.updateObject(org) ;
	}

	@Override
	public PageModel<Organization> seacheOrgDataDao(String hql,
			String whereHQL, List<Object> param, int firstResult,
			int maxResult, LinkedHashMap<String, String> orderby)
			throws RuntimeException {
		return this.getScrollData(hql, whereHQL, param, firstResult, maxResult, orderby) ;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Organization> getOrgAllDao(String hql, LinkedHashMap<String, String> orderby) throws RuntimeException {
		return (List<Organization>) this.find(hql, orderby);
	}

}
